#!/bin/bash

# double-take配置文件
cp /media/config/double-take/config/config.yml /media/config/double-take/config/config.yml.bk
mkdir -p /media/config/double-take/config
touch /media/config/double-take/config/config.yml

# double-take
cat << EOF > /media/config/double-take/config/config.yml
# Double Take
# Learn more at https://github.com/skrashevich/double-take/#configuration
auth: true
 
mqtt:
  host: 192.168.1.180
  username: admin
  password: HK123456
# 这里的事件传递给 homeassistant 为后面的消息通知做准备
  topics:
    # mqtt topic for frigate message subscription
    frigate: frigate/events
    #  mqtt topic for home assistant discovery subscription
    homeassistant: homeassistant
    # mqtt topic where matches are published by name
    matches: double-take/matches
    # mqtt topic where matches are published by camera name
    cameras: double-take/cameras
 

detect:
  match:
    # save match images
    save: true
    # include base64 encoded string in api results and mqtt messages
    # options: true, false, box
    base64: false
    #识别率
    confidence: 60
    # hours to keep match images until they are deleted
    purge: 168
    # 最小识别框BOX面积
    min_area: 1000

  unknown:
    # save unknown images
    save: true
    # include base64 encoded string in api results and mqtt messages
    # options: true, false, box
    base64: false
    # minimum confidence needed before classifying a name as unknown
    confidence: 40
    # hours to keep unknown images until they are deleted
    purge: 8
    # minimum area in pixels to keep an unknown result
    min_area: 0
    
frigate:
# https://frigate-noauth.localnas.top
  url: http://192.168.1.180:5000
# 需要获取的 frigate 标签
  labels:
    - person
# 需要获取的摄像头名
  Frigate:
    - door
 
detectors:
#  deepstack:
#    url: http://deepstack:5000
##    key:
#    # number of seconds before the request times out and is aborted
#    timeout: 15
#    # require opencv to find a face before processing with detector
#    opencv_face_required: false
#    # only process images from specific cameras, if omitted then all cameras will be processed
#    cameras:
#     - door
 
  aiserver:
    url: http://192.168.1.180:32168
    # number of seconds before the request times out and is aborted
    timeout: 15
    # require opencv to find a face before processing with detector
    opencv_face_required: false
    friagte:
     - door
 
time:
  # defaults to iso 8601 format with support for token-based formatting
  # https://github.com/moment/luxon/blob/master/docs/formatting.md#table-of-tokens
  format: yyyy-MM-dd hh:mm:ss
  # time zone used in logs
  timezone: Asia/Shanghai

EOF